package snowflake

import (
	"github.com/sony/sonyflake"
	"sync"
)

var sf *sonyflake.Sonyflake

func initSf() {
	var st sonyflake.Settings
	sf = sonyflake.NewSonyflake(st)
	if sf == nil {
		panic("sonyflake not created")
	}
}
var once sync.Once

func NextID() (int64, error) {
	once.Do(func() {
		initSf()
	})
	id, err := sf.NextID()
	return int64(id * 10), err
}

